Sync with changes in the cairo device-scale handling
authorAlexander Larsson <alexl@redhat.com>
Thu, 5 Sep 2013 17:30:23 +0000 (19:30 +0200)
committerAlexander Larsson <alexl@redhat.com>
Thu, 5 Sep 2013 17:30:23 +0000 (19:30 +0200)
The version of device scale that landed in upstream cairo
master already inherits the device scale in cairo_create_similar,
so no need to do that in gtk anymore.

gdk/gdkwindow.c
gtk/gtkcssimage.c

index 55f5bf285520719a9c5b1a8b1501dffdb13eb77c..a07d3b44c3c1d72d4b54c89a3a4cc698b2543741 100644 (file)
@@ -9252,21 +9252,24 @@ gdk_window_create_similar_surface (GdkWindow *     window,
   cairo_surface_get_device_scale (window_surface, &sx, &sy);
 #endif
 
-  width = width * sx;
-  height = height * sy;
-
   switch (_gdk_rendering_mode)
   {
     case GDK_RENDERING_MODE_RECORDING:
       {
-        cairo_rectangle_t rect = { 0, 0, width, height };
+        cairo_rectangle_t rect = { 0, 0, width * sx, height *sy };
         surface = cairo_recording_surface_create (content, &rect);
+#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
+        cairo_surface_set_device_scale (surface, sx, sy);
+#endif
       }
       break;
     case GDK_RENDERING_MODE_IMAGE:
       surface = cairo_image_surface_create (content == CAIRO_CONTENT_COLOR ? CAIRO_FORMAT_RGB24 :
                                             content == CAIRO_CONTENT_ALPHA ? CAIRO_FORMAT_A8 : CAIRO_FORMAT_ARGB32,
-                                            width, height);
+                                            width * sx, height * sy);
+#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
+      cairo_surface_set_device_scale (surface, sx, sy);
+#endif
       break;
     case GDK_RENDERING_MODE_SIMILAR:
     default:
@@ -9276,9 +9279,6 @@ gdk_window_create_similar_surface (GdkWindow *     window,
       break;
   }
 
-#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
-  cairo_surface_set_device_scale (surface, sx, sy);
-#endif
 
   cairo_surface_destroy (window_surface);
 
index 33c85f2abf55ad52e75dd51742fcb8606613a6a6..042086b1f0109df6d5ca0774bd0567e8447500bd 100644 (file)
@@ -398,20 +398,10 @@ _gtk_css_image_get_surface (GtkCssImage     *image,
 
   if (target)
     {
-#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
-      cairo_surface_get_device_scale (target, &sx, &sy);
-#else
-      sx = sy = 1;
-#endif
-
       result = cairo_surface_create_similar (target,
                                             CAIRO_CONTENT_COLOR_ALPHA,
-                                            surface_width*sx,
-                                            surface_height*sy);
-
-#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
-      cairo_surface_set_device_scale (result, sx, sy);
-#endif
+                                            surface_width,
+                                            surface_height);
     }
   else
     result = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,